﻿/**********************************************************************
 * @file   OperGroup.h
 * @brief  分组操作器声明
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2025-02-12
 *********************************************************************/
#ifndef _OPER_GROUP__H___
#define _OPER_GROUP__H___

#include "FITK_Kernel/FITKCore/FITKActionOperator.h"
#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h"
#include <QObject>

namespace Interface {
    class FITKAbsVirtualTopo;
}

namespace GUIOper
{
    /**
     * @brief  分组操作器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2025-02-12
     */
    class OperGroup : public Core::FITKActionOperator
    {
         Q_OBJECT
    public:
        /**
         * @brief  Construct a new Oper Group object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-12
         */
        explicit OperGroup() = default;
        /**
         * @brief  Destroy the Oper Group object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-12
         */
        virtual ~OperGroup() = default;
        /**
         * @brief 界面逻辑，生成UI交互
         * @return true             执行成功
         * @return false            执行失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-12
         */
        virtual bool execGUI() override;
        /**
         * @brief 业务处理逻辑，在execGUI后执行
         * @return true             执行成功
         * @return false            执行失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-12
         */
        virtual bool execProfession() override;

    private slots:
        /**
         * @brief  更新分组树
         * @author guqingtao (15598887859@163.com)
         * @date   2025-02-18
         */
        void updateGroupTreeSlot();

    private:
        /**
         * @brief    更新分组树节点状态
         * @return   void
         * @author   guqingtao (15598887859@163.com)
         * @date     2025-02-20
         */
        void updateGroupTreeState();
        /**
         * @brief    创建组件操作
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-12
         */
        void createGroupOper();
        /**
         * @brief    编辑操作
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-18
         */
        void editOper();
        /**
         * @brief    编辑分组数据操作
         * @param[i] groupObjID
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-12
         */
        void editGroupOper(int groupObjID);
        /**
         * @brief    显示操作
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-18
         */
        void showOper();
        /**
         * @brief    隐藏操作
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-18
         */
        void hideOper();
        /**
         * @brief    仅显示操作
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-18
         */
        void showOnlyOper();
        /**
         * @brief    更新分组状态和更新objID数据
         * @param[i] groupIDList 
         * @param[o] objIDList 
         * @param[i] isRoot 
         * @param[i] state
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-18
         */
        void updateGroupState(QList<int> groupIDList, QList<int>& objIDList, bool isRoot, bool state);
        /**
         * @brief    设置数据显隐
         * @param[i] objList 数据链表 key:objID
         * @param[i] type 类型 1：显示 2：隐藏 3：仅显示
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-18
         */
        void setObjShowOrHide(QList<int> objList, int type);
        /**
         * @brief    获取所有的几何对象中的所有虚拓扑对象
         * @return   QList<Interface::FITKAbsVirtualTopo*>             虚拓扑列表
         * @author   BaGuijun (baguijun@163.com)
         * @date     2025-02-18
         */
        QList<Interface::FITKAbsVirtualTopo*> getAllGeometryVirTopos();
    };

    // 按钮注册相关操作
    Register2FITKOperatorRepo(actionCreateGroup, OperGroup);
    Register2FITKOperatorRepo(actionGroupEdit, OperGroup);
    Register2FITKOperatorRepo(actionGroupShow, OperGroup);
    Register2FITKOperatorRepo(actionGroupHide, OperGroup);
    Register2FITKOperatorRepo(actionGroupShowOnly, OperGroup);
}

#endif
